<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h2>ref</h2>
      <!-- <div id="box">hello</div> -->
      <div ref="box">hello</div>
    </div>

    <script src="./lib/vue3.js"></script>
    <script>
      Vue.createApp({
        data() {
          return {};
        },
        // 如果想拿dom节点，必须在mounted或者以后
        mounted() {
          // console.log(document.querySelector("#box"));
          console.log(this.$refs.box);
        },
      }).mount("#app");
    </script>
  </body>
</html>
